package shiyan2;

public class Yongjin {

        public static String yongjin(int locks, int stocks, int barrels) {
                double lockprice = -45;
                double stockprice = 30;
                double barrelprice = 25;
                double totallocks = 0;
                double totalstocks = 0;
                double totalbarrels = 0;
                double commission;
//                Scanner input=new Scanner(System.in);
//                System.out.print( "Input the locks,stocks and barrels:");
//                int locks=input.nextInt();
                if (locks == -1) {
                        System.out.print("当月销售活动结束! \n");
                        return "当月销售活动结束!";
                }
                if (1 > locks || locks >= 70)
                        return "对不起，枪机数不能为负数且厂商限制一个月只能卖出少于70个!";
                if (1 > stocks || stocks >= 80)
                        return "对不起，枪托数不能为负数且厂商限制一个月只能卖出少于80个!";
                if (1 > barrels || barrels >= 90)
                        return "对不起，枪管数不能为负数且厂商限制-一个月只能卖出少于90个!";
                totallocks = totallocks + locks;
                totalstocks = totalstocks + stocks;
                totalbarrels = totalbarrels + barrels;
                double locksales = lockprice * totallocks;
                double stocksales = stockprice * totalstocks;
                double barrelsales = barrelprice * totalbarrels;
                double sales = locksales + stocksales + barrelsales;
                if (sales > 1800) {
                        commission = 0.10 * 1000;
                        commission = commission + 0.15 * 800;
                        commission = commission + 0.20 * (sales - 1800);
                } else if (sales > 1000) {
                        commission = 0.10 * 1000;
                        commission = commission + 0.15 * (sales - 1000);
                } else commission = 0.10 * sales;
                System.out.print("commission is $:" + commission);
                return "佣金为$:" + commission;
        }
}
